<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateTasksTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('tasks', function(Blueprint $table)
		{
			$table->increments('id');
			$table->dateTime('start_date');
			$table->dateTime('end_date');
			$table->string('title')->default('');
			$table->text('text', 65535);
			$table->integer('liste')->default(0)->index('tasks_liste');
			$table->integer('status')->index('idx_tasks_status');
			$table->text('status_update')->nullable();
			$table->integer('project')->default(0)->index('idx_tasks_project');
			$table->integer('phase')->index('idx_tasks_phase');
			$table->integer('deliverable_item')->nullable()->index('idx_tasks_deliverable_item');
			$table->integer('parent')->nullable();
			$table->string('location')->default('Shanghai');
			$table->boolean('valid')->default(1);
			$table->timestamp('created_date')->nullable()->default(DB::raw('CURRENT_TIMESTAMP'));
			$table->integer('created_by')->nullable();
			$table->timestamps();
			$table->softDeletes();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('tasks');
	}

}
